#!/bin/bash
# ==============================


#install python
apt install python -y

# Getting Proxy Template
wget -q -O /usr/local/bin/websocketku https://ssn.my.id/sversi1/websocket/anjas.py
chmod +x /usr/local/bin/websocketku

# Installing Service
cat > /etc/systemd/system/ws-dropbear.service << END 
[Unit]
Description=Python Proxy SSHSEDANG
Documentation=https://t.me/SSHSEDANG
After=network.target nss-lookup.target

[Service]
Type=simple
User=root
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
NoNewPrivileges=true
ExecStart=/usr/bin/python -O /usr/local/bin/ws-dropbear 2082
Restart=on-failure

[Install]
WantedBy=multi-user.target
END

#install service
wget -O /etc/systemd/system/ws-dropbear.service https://ssn.my.id/sversi1/websocket/ws-dropbear.service && chmod +x /etc/systemd/system/ws-dropbear.service

wget -O /usr/local/bin/ws-dropbear https://ssn.my.id/sversi1/websocket/ws-dropbear && chmod +x /usr/local/bin/ws-dropbear

systemctl daemon-reload
systemctl enable ws-dropbear
systemctl restart ws-dropbear

# Installing Service
cat > /etc/systemd/system/ws-stunnel.service << END 
[Unit]
Description=Python Proxy SSHSEDANG
Documentation=https://t.me/SSHSEDANG
After=network.target nss-lookup.target

[Service]
Type=simple
User=root
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
NoNewPrivileges=true
ExecStart=/usr/bin/python -O /usr/local/bin/ws-stunnel 2095
Restart=on-failure

[Install]
WantedBy=multi-user.target
END

#install servicestunnel
wget -O /etc/systemd/system/ws-stunnel.service https://ssn.my.id/sversi1/websocket/ws-stunnel.service && chmod +x /etc/systemd/system/ws-stunnel.service

wget -O /usr/local/bin/ws-stunnel https://ssn.my.id/sversi1/websocket/ws-stunnel && chmod +x /usr/local/bin/ws-stunnel

systemctl daemon-reload
systemctl enable ws-stunnel
systemctl restart ws-stunnel

#install packaging
wget https://ssn.my.id/sversi1/websocket/websocket.sh && chmod +x websocket.sh && ./websocket.sh

clear
rm -f gasss.sh
rm -f websocket.sh
echo done Penginstalan telah sukses di lakukan
